<?php

/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/10/21
 * Time: 17:29
 */

namespace app\adminapiv3\service;


class Test extends Base
{
    function test($content)
    {
        //echo 111;die;
        $this->setError(201, 'fail');
        return false;
    }

    /**
     * @name 添加日志
     * @author wx
     * @date 2020/5/25 17:17
     */
    function addLog()
    {
        global $content;//日志内容
        global $errCode;//错误码
        global $errMsg;//错误信息

        $status = 1;
        $data['type'] = 1;
        $data['ip'] = $_SERVER['REMOTE_ADDR'];
        $data['address'] = '测试重庆';
        $data['user_id'] = 1;
        $data['ctime'] = time();

        $data['syslog'] = 1;
        $data['elk'] = 1;

        if(!empty($content)){
            if($errCode != $this->CODE_SUCCESS){
                $content = $content.'失败，失败原因：'.$errMsg;
                $status = 0;
            }

            $data['content'] = $content;
            $data['status'] = $status;

            db('server_option_history')->insert($data);
        }

    }
}